package tm.operations;

import java.math.BigDecimal;
import java.util.List;

import tm.data.DaoFactory;
import tm.data.PositionsDao;

public class PositionOperations {

	PositionsDao positionDao = DaoFactory.getInstance().getPositionsDao();
	
	/** Intent: Return a list of Positions Objects.
	 * Return empty Positions list if none exists.
	 * 
	 * This is supporting method to satisfy the requirement described in SRS Section 3.2.1.1 Use Case: Edit Positions.
	 * 
	 * @return List of Positions Objects
	 */
	public List getPositions(){
		return positionDao.positionsDBQuery();
	}
	
	/** Intent: Save a newly created Positions Object.
	 * 
	 * Precondition: Position Object exist in Database or may not exist in Database.
	 * 
	 * This method satisfies the requirement described in SRS Section 3.2.1.1 Use Case: New Positions, Edit Position.
	 * 
	 * PostCondition #1: If the Positions Object exist in database, it will be updated with new details.
	 * PostCondition #2: If the Positions Object does not exist in database, new position will be created in database.
	 * 
	 * @return None
	 */
	public void createPosition(int id, String name, String desc, BigDecimal minSal, BigDecimal maxSal){
		positionDao.positionDBSave(id, name, desc, minSal, maxSal);
	}
}
